package cn.gailvlun.gll.presentation.emotion

import android.content.Context
import cn.gailvlun.gll.R
import cn.gailvlun.gll.net.emotion.Emotion
import cn.gailvlun.gll.presentation.emotion.core.BaseAdapter
import org.jetbrains.annotations.NotNull


class EmotionSameListAdapter : BaseAdapter<Any> {
    constructor(context: Context?) : super(context) {
        addViewTypeToLayoutMap(Type.HEADER.ordinal, R.layout.item_emotion_same_list_header)
        addViewTypeToLayoutMap(Type.CONTENT.ordinal, R.layout.item_emotion_same_list_emotion)
        addViewTypeToLayoutMap(Type.EMPTY.ordinal, R.layout.item_emotion_empty)
    }

    enum class Type {
        HEADER,
        CONTENT,
        EMPTY
    }

    override fun removeCondition(@NotNull whichItem: Any, @NotNull certainItem: Any): Boolean {
        whichItem as Emotion
        certainItem as Emotion
        return whichItem.id == certainItem.id || super.removeCondition(whichItem, certainItem)
    }

    override fun notifyItemChangedCondition(whichItem: Any, certainItem: Any): Boolean {
        whichItem as Emotion
        certainItem as Emotion
        return whichItem.id == certainItem.id || super.notifyItemChangedCondition(whichItem, certainItem)
    }

}